<template>
  <div class="">
    <div class="title">
      <span class="title_big">信箱管理-列表</span>
      <span class="title_small">（共1条）</span>
    </div>
    <el-form
      size="mini"
      :inline="true"
      :model="searchForm"
      class="demo-form-inline search"
    >
      <el-form-item label="标题">
        <el-input
          v-model="searchForm.realname"
          size="mini"
          placeholder=""
        ></el-input>
      </el-form-item>
      <el-form-item label="类型" width="60">
        <el-select
          size="mini"
          v-model="searchForm.orgname"
          clearable
          placeholder="请选择"
        >
          <el-option value="wu"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="收件人">
        <el-select
          size="mini"
          v-model="searchForm.role"
          clearable
          placeholder="请选择"
        >
          <el-option value="管理员"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="发件人">
        <el-select
          size="mini"
          v-model="searchForm.memberGroup"
          clearable
          placeholder="请选择"
        >
          <el-option value="wu"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="回复状态">
        <el-select
          size="mini"
          v-model="searchForm.type"
          clearable
          placeholder="请选择"
        >
          <el-option value="wu"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item>
        <el-button size="mini" type="info" @click="Search">搜索</el-button>
      </el-form-item>
    </el-form>
    <div class="filter">
      <el-button type="info" @click="editUser">查看</el-button>
      <el-button type="info">回复</el-button>
      <el-button type="info">下载</el-button>
      <el-button type="info">信箱设置</el-button>
    </div>
    <div class="dropdown">
      <div>
        <el-table
          :data="tableData"
          style="width: 100%"
          :default-sort="{ prop: 'date', order: 'descending' }"
        >
          <el-table-column
            type="selection"
            label="全选"
            width="55"
          ></el-table-column>
          <el-table-column prop="name" label="名称" sortable width="100">
            {{name}}
          </el-table-column>
          <el-table-column prop="net" label="标题" sortable width="180">
            {{title}}
          </el-table-column>
          <el-table-column prop="date" label="内容" sortable width="460">
            <span class="present"
              >{{content}}</span
            > </el-table-column
          ><el-table-column prop="reply" label="类型" sortable width="120">
          </el-table-column>
          <el-table-column prop="title" label="收件人" sortable width="120">
            <span>戴用名</span>
          </el-table-column>
          <el-table-column prop="date" label="留言时间" sortable width="180">
            {{time}}
          </el-table-column>
          <el-table-column prop="state" label="附件" sortable width="120">
          </el-table-column>
          <el-table-column prop="operate" label="操作" :formatter="formatter">
            <span class="columns">查看</span><span class="copy">回复</span
            ><span class="modify">下载</span>
          </el-table-column>
        </el-table>
        <el-pagination
          @size-change="handleSize"
          @current-change="handlePage"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="10"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        ></el-pagination>
      </div>
      <Drawer :isDrawer.sync="isDrawer" :size="'60%'">
      <Stay></Stay>
      <template #footer>
        <el-button size="medium" @click="closeDrawer">取消</el-button>
        <el-button type="primary" size="medium">保存</el-button>
      </template>
    </Drawer>
    </div>
  </div>
</template>

<script >
import Drawer from "@/components/drawer";
import Stay from './components/Stay.vue';
import * as api from "./api";
export default {
  name: "",
  components: {
    Drawer,
    Stay,
  },
  data() {
    return {
      isDrawer: false,
      time: "",
      name:"",
      title:"",
      content:"",
      searchForm: {
        realname: "",
        orgname: "",
        role: "",
        memberGroup: "",
        type: "",
        status: "",
        name:"",
        addressee:"",
      },
      userForm: [
        {
          realname: "用户一",
          userid: 1,
          grade: "管理员",
        },
      ], //用户列表
      total: null, //总条数
      page: 1, //页数
      size: 10, //条数
      input2: "",
      tableData: [
        {
          state: "无",
          reply: "是",
          net: "标题标题标题",
          date: "2016-05-02",
          name: "{{name}}",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          state: "无",
          reply: "是",
          net: "标题标题标题",
          date: "2016-05-04",
          name: "戴用名",
          address: "上海市普陀区金沙江路 1517 弄",
        },
        {
          state: "无",
          reply: "是",
          net: "标题标题标题",
          date: "2016-05-01",
          name: "戴用名",
          address: "上海市普陀区金沙江路 1519 弄",
        },
        {
          state: "无",
          reply: "是",
          net: "标题标题标题",
          date: "2016-05-03",
          name: "戴用名",
          address: "上海市普陀区金沙江路 1516 弄",
        },
      ],
    };
  },
  created() {
    this.mail()
  },
  methods: {
    // 邮件查询
    mail() {
      const params = {
        userId: 1,
      };
      api.mailQuery(params).then((res) => {
          console.log(222,res.data.list[2]);
        this.time = res.data.list[2].createdDate
        this.name = res.data.list[2].userName
        this.content = res.data.list[2].mailMessage
        this.title = res.data.list[2].mailName
      });
    },
    editUser() {
      this.isDrawer = true;
    },
    closeDrawer() {
      this.isDrawer = false;
    },
  },
};
</script>

<style lang="" scoped>
.search {
  height: 54px;
  background-color: #ffffff;
  border-radius: 5px;
  box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  padding: 13px 10px 0;
  margin: 20px 0 30px;
}
.columns {
  color: rgba(251, 83, 75, 1);
  margin-right: 20px;
}
.modify {
  color: rgba(251, 83, 75, 1);
  margin-right: 20px;
}
.copy {
  color: rgba(251, 83, 75, 1);
  margin-right: 20px;
}
.present {
  font-family: Source Han Sans CN;
  color: #666666;
  font-size: 16px;
}
.original {
  font-family: Source Han Sans CN;
  color: #6878f0;
  font-size: 16px;
}
.eject {
  margin-top: 20px;
}
.filter > div {
  width: 56px;
  height: 24px;
  background-color: #6878f0;
  border-radius: 5px;
  box-shadow: 0px 0px 6px rgba(0, 12, 100, 0.2);
  margin-left: 20px;
}
.filter {
  display: flex;
  margin-top: 25px;
  margin-bottom: 10px;
}
.title_big {
  width: 153px;
  height: 24px;
  font-family: Source Han Sans CN;
  font-weight: 700;
  color: #666666;
  font-size: 24px;
}
.title {
  margin-left: 20px;
  margin-top: 40px;
  margin-bottom: 20px;
}
</style>

